import React from 'react'
import { render } from 'react-dom';
import { Router, Route, IndexRoute } from 'react-router'
import View from 'lib/View.jsx'
import Layout from '../common/layout.jsx'
import RootView from './RootView.jsx'
import DateRangePicker from '../common/DateRangePicker.jsx'
import history from '../common/history.es6';

class MainView extends View {
  render () {
    return (
      <Layout title="活跃分析" subtitle="活跃分析" extra={ <DateRangePicker /> } hideTime={ true } hideVersion={ true }>
        { React.cloneElement(this.props.children, { routeParams: this.props.params, key: this.getHandlerKey() }) }
      </Layout>
    );
  }
}

render((
  <Router history={ history }>
    <Route path="/" component={ MainView }>
      <IndexRoute component={ RootView } />
    </Route>
  </Router>
), document.getElementById('root'));
